import Vue from 'vue'
import Router from 'vue-router'
import iView from 'iview'

//路由配置
// 登陆界面
import Login from '@/view/login/login.vue'
// 注册界面
import Register from '@/view/register/register.vue'
// 主页
import Home from '@/view/home/home.vue'
// 主页内容区
import Index from '@/view/index/index.vue'
// 消息管理页
import Message from '@/view/message/message.vue'
//首页
import homePage from '@/view/homePage/homePage.vue'
//我的快捷

//快捷1
import shortcut1 from '@/view/shortcut1/shortcut1.vue'
//快捷2
import shortcut2 from '@/view/shortcut2/shortcut2.vue'
//快捷3
import shortcut3 from '@/view/shortcut3/shortcut3.vue'
//快捷设置
import Setshortcut from '@/view/Setshortcut/Setshortcut.vue'
//工作流管理
//事务管理
//申请事务
import TaskManager from '@/view/TaskManager/TaskManager.vue'
//申请列表
import ApplyList from '@/view/applyList/applyList.vue'
//审批事务
import ExamineTransaction from '@/view/examineTransaction/examineTransaction.vue'
//流程管理
//新建流程
import NewFlow from '@/view/NewFlow/NewFlow.vue'
//处理流程
import DealFlow from '@/view/dealFlow/dealFlow.vue'
//个人中心
//基本信息
import BaseInfo from '@/view/BaseInfo/BaseInfo.vue'
//我的审批
import MyApprove from '@/view/MyApprove/MyApprove.vue'
//系统设置
//用户管理
import UserManager from '@/view/UserManager/UserManager.vue'
//角色管理
import RoleManager from '@/view/RoleManager/RoleManager.vue'
//权限管理
import RightsManagement from '@/view/RightsManagement/RightsManagement.vue'
//部门管理
import DeptManager from '@/view/DeptManager/DeptManager.vue'
//功能模块管理
import FunctionModuleManager from '@/view/FunctionModuleManager/FunctionModuleManager.vue'
//数据字典管理
import DictionaryManager from '@/view/DictionaryManager/DictionaryManager.vue'
//系统日志
import SystemLog from '@/view/SystemLog/SystemLog.vue'
//个性化管理
import  IndividuationManager from '@/view/IndividuationManager/IndividuationManager.vue'


// vue引用
Vue.use(Router)

const router = new Router({
	mode: 'history',
	routes: [{
		path: '/',
		component: Login
	}, {
		path: '/register',
		component: Register
	}, {
		path: '/login',
		component: Login
	}, {
		path: '/home',
		component: Home,
		children: [{
				path: '/index',
				component: Index
			}, {
				path: '/message',
				component: Message
			}, {
				path: '/homePage',
				component: homePage
			}, { //快捷1
				path: '/shortcut1',
				component: shortcut1
			}, { //快捷2
				path: '/shortcut2',
				component: shortcut2
			}, { //快捷3
				path: '/shortcut3',
				component: shortcut3
			}, { //快捷设置
				path: '/Setshortcut',
				component: Setshortcut
			}, { //申请事务
				path: '/TaskManager',
				component: TaskManager
			}, { //申请列表
				path: '/applyList',
				component: ApplyList
			}, { //审批事务
				path: '/examineTransaction',
				component: ExamineTransaction
			}, { //新建流程
				path: '/NewFlow',
				component: NewFlow
			}, { //处理流程
				path: '/dealFlow',
				component: DealFlow
			}, { //基本信息
				path: '/BaseInfo',
				component: BaseInfo
			}, { //我的审批
				path: '/MyApprove',
				component: MyApprove
			}, { //用户管理
				path: '/UserManager',
				component: UserManager
			}, { //角色管理
				path: '/RoleManager',
				component: RoleManager
			}, { //权限管理
				path: '/RightsManagement',
				component: RightsManagement
			}, { //部门管理
				path: '/DeptManager',
				component: DeptManager
			}, { //功能模块管理
				path: '/FunctionModuleManager',
				component: FunctionModuleManager
			}, { //数据字典管理
				path: '/DictionaryManager',
				component: DictionaryManager
			}, { //系统日志
				path: '/SystemLog',
				component: SystemLog
			}, { //个性化管理
				path: '/IndividuationManager',
				component: IndividuationManager
			}
			
		]
	}]
})

router.beforeEach((to, from, next) => {
	// console.log(to);
	iView.LoadingBar.start();
	next();
});

router.afterEach((to, from, next) => {
	iView.LoadingBar.finish();
	window.scrollTo(0, 0);
});

export default router;